<template>
  <el-checkbox
    :value="value"
    @input="handleModelInput"
    @change="handleChange"
    :true-label="fld['true-label']"
    :false-label="fld['false-label']"
    :disabled="fld.disabled"
    size="mini"
    >{{fld.text}}
  </el-checkbox>
</template>
<script type="text/javascript">
  define(['vue'],function(vue){
    //注意下面不能使用label
    return vue.component('comp-checkbox',{
      props:['fld','value'],
      template: template,
      methods:{
        handleModelInput :function(val){
          this.$emit("input", val);
        },
        //val为更新后的值
        handleChange :function(val){
          var key = `${this.fld.name}:change`;
          if(!this.$root.callbacks[key]) return;
          this.$root.callbacks[key].apply(this,arguments);
        },
      }
    });
  });
</script>